<?php

namespace Server\Controller;
use Think\Controller\HproseController;
class WeixinController extends HproseController {
	const appid = 'wx49c30ba26e2b3142';
	const appsecret = 'd4624c36b6795d1d99dcf0547af5443d';

	// function getAccessToken(){
	// 	$result = linkurl('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.self::appid.'&secret='.self::appsecret,'',2);
	// 	$temp = json_decode($result, true);
	// 	return $temp['access_token'];
	// }
	//
	// public function getUserInfo($openid){
	// 	$accesstoken = $this->getAccessToken();
	// 	$result = linkurl('https://api.weixin.qq.com/cgi-bin/user/info?access_token='.$accesstoken.'&openid='.$openid,'',2);
	// 	$result = json_decode($result);
	// 	return $result;
	// }

	public function getUserInfo($wgateid){
		$result = linkurl('http://www.weixingate.com/wgate_user.php?wgateid='.$wgateid,'',1);
		$result = json_decode($result);
		return $result;
	}
}
